/*
 * @Description: 读取文件夹
 * @Author: dh
 * @Date: 2021-09-02 16:51:50
 * @LastEditors: dh
 * @LastEditTime: 2022-03-29 11:38:10
 */
const fs = require('fs')
const path = require('path')
// 异步读取文件

// 同步读取文件
try {
	var res = fs.readdirSync(__dirname) // [ 'index.js', 'test.js' ]
	res.forEach(v => {
		const location = path.join(__dirname, v)
		console.log(location)
	})
	console.log(res)
} catch (err) {
	console.log(err)
}
